var Middleware = require('./middleware.js') // <- this is the file you make;

var middleware = new Middleware();

middleware.use(function(next) {
    var self = this;
    setTimeout(function() {
        self.hook1 = true;
        console.log('hook1已执行，耗时', Date.now() - start)
        next();
    }, 1000);
});

middleware.use(function(next) {
    var self = this;
    setTimeout(function() {
        self.hook2 = true;
        console.log('hook2已执行，耗时', Date.now() - start)
        next();
    }, 1000);
});

var start = Date.now();
middleware.go(function() {
    console.log(this.hook1); // true
    console.log(this.hook2); // true
    console.log(Date.now() - start); // around 2000
});
